<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
<!-- Google Chrome Frame也可以让IE用上Chrome的引擎: -->
<meta name="renderer" content="webkit">
<!--国产浏览器高速模式-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="穷在闹市" />
<!-- 作者 -->
<meta name="revised" content="穷在闹市.v3, 2019/05/01" />
<!-- 定义页面的最新版本 -->
<meta name="description" content="网站简介" />
<!-- 网站简介 -->
<meta name="keywords" content="搜索关键字，以半角英文逗号隔开" />
<title>明联人才后台</title>

<!-- 公共样式 开始 -->
<link rel="stylesheet" type="text/css" href="back_cssAndjs/css/base.css">
<link rel="stylesheet" type="text/css"
	href="back_cssAndjs/css/iconfont.css">
<script type="text/javascript"
	src="back_cssAndjs/framework/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="back_cssAndjs/layui/css/layui.css">
<script type="text/javascript" src="back_cssAndjs/layui/layui.js"></script>
<!-- 滚动条插件 -->
<link rel="stylesheet" type="text/css"
	href="back_cssAndjs/css/jquery.mCustomScrollbar.css">
<script src="back_cssAndjs/framework/jquery-ui-1.10.4.min.js"></script>
<script src="back_cssAndjs/framework/jquery.mousewheel.min.js"></script>
<script src="back_cssAndjs/framework/jquery.mCustomScrollbar.min.js"></script>
<script src="back_cssAndjs/framework/cframe.js"></script>
<!-- 仅供所有子页面使用 -->
<!-- 公共样式 结束 -->

</head>

<div class="demoTable">
	搜索姓名：
	<div class="layui-inline">
		<input class="layui-input" id="strLike" name="strLike"
			autocomplete="off">
	</div>
	<button class="layui-btn" data-type="reload" type="button">搜索</button>
</div>

<table class="layui-hide" id="LAY_table_user" lay-filter="demo" height="550"></table>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<!--<script src="//res.layui.com/layui/dist/layui.js" charset="utf-8"></script>-->
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
	layui.use('table', function() {
		var table = layui.table;

		//方法级渲染
		table.render({
			elem : '#LAY_table_user',
			url : 'rec_list',
			cols : [ [ {
				checkbox : true,
				fixed : true
			}, {
				field : 'recId',
				title : 'ID',
				width : 80,
				sort : true,
				fixed : true
			}, {
				field : 'recName',
				title : '招聘会名称',
				width : 115
			}, {
				field : 'startTime',
				title : '举办时间',
				width : 105,
				sort : true
			}, {
				field : 'applyTime',
				title : '报名时间',
				width : 115
			}, {
				field : 'place',
				title : '举办地点'

			}, {
				field : 'sponsor',
				title : '主办方',
				sort : true,
				width : 105
			}, {
				field : 'recTel',
				title : 'Tel',
				sort : true,
				width : 115
			}, {
				field : 'recState',
				title : '状态',
				sort : true,
				width : 115
			}, {
				title : '操作',
				toolbar : '#barDemo',
				width : 300
			} ] ],
			id : 'testReload',
			page : true,
			height : 350
		});

		//监听工具条
		table.on('tool(demo)', function(obj) {
			var data = obj.data;
			if (obj.event === 'del') {
				layer.confirm('真的删除行么', function(index) {

					// ajax请求
					$.post("delrec", "recId=" + data.recId, function(data) {
						// 处理返回的删除结果
						layer.msg(data == "true" ? "删除成功!" : "删除失败!", {
							icon : 1
						});
						obj.del();// 假删除操作(仅前端删除)
						layer.close(index);// 关闭提示框
					});
				});
			} else if (obj.event === 'edit') {

				// 给相应文本框复制
				$("#recId").val(data.recId);
				$("#recName").val(data.recName);
				$("#test5").val(data.startTime);
				$("#test7").val(data.applyTime);
				$("#place").val(data.place);
				$("#sponsor").val(data.sponsor);
				$("#recTel").val(data.recTel);
				$("#recState").val(data.recState);
				// 如果是单选按钮操作,我们需要render一下
				layui.form.render();

				layer.open({
					type : 1,
					title : '修改招聘会信息',
					content : $('#div1'),
					area : [ '450px', '500px' ]

				});
			}
		});

		var $ = layui.$, active = {
			reload : function() {
				var demoReload = $('#strLike');

				//执行重载
				table.reload('testReload', {
					page : {
						curr : 1
					//重新从第 1 页开始
					},
					where : {
						"strLike" : demoReload.val()
					}
				}, 'data');
			}
		};

		$('.demoTable .layui-btn').on('click', function() {
			var type = $(this).data('type');
			active[type] ? active[type].call(this) : '';
		});
	});
</script>

<div id="div1" style="display: none; text-align:;">
	<form class="layui-form" action="updrec" lay-filter="example">
		<div class="layui-form-item">
			<label class="layui-form-label newbie-width-one">招聘会名称</label>
			<div class="layui-input-block">
				<input type="text" name="recName" id="recName" lay-verify="title"
					autocomplete="off" readonly placeholder="请输入企业名"
					class="layui-input newbie-width-two">
			</div>
		</div>
		
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">报名日期</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="applyTime" id="test7"
						placeholder=" - ">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">举办时间</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="startTime" id="test5"
						placeholder="yyyy-MM-dd HH:mm:ss">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label newbie-width-one">举办地点</label>
			<div class="layui-input-block">
				<input type="text" name="place" id="place" lay-verify="title"
					autocomplete="off" placeholder="举办地点"
					class="layui-input newbie-width-two">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label newbie-width-one">状态</label>
			<div class="layui-input-block newbie-width-two">
				<select name="recState" id="recState" lay-filter="aihao">
					<option value=""></option>
					<option value="1">未开始</option>
					<option value="2">进行中</option>
					<option value="3">已结束</option>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label newbie-width-one">联系电话</label>
			<div class="layui-input-block">
				<input type="text" name="recTel" id="recTel" lay-verify="title"
					autocomplete="off" placeholder="联系电话"
					class="layui-input newbie-width-two">
				<input type="hidden" name="recId" id="recId" lay-verify="title"
					autocomplete="off" 
					class="layui-input newbie-width-two">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button type="submit" class="layui-btn">立即提交</button>
			</div>
		</div>
	</form>
</div>

<script>
	layui.use('laydate', function() {
		var laydate = layui.laydate;

		//报名时间
		laydate.render({
			elem : '#test7',
			range : true
		});
		//日期时间选择器
		laydate.render({
			elem : '#test5',
			type : 'datetime'
		});
	});
</script>

</body>
</html>